package com.syy.hive;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class Video implements WritableComparable<Video> {
    private String videoId;
    private String uploader;
    private Integer age;
    private String category;
    private Integer length;
    private Integer views;
    private Double rate;
    private Integer rating;
    private Integer comments;
    private String relatedId;

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getRelatedId() {
        return relatedId;
    }

    public void setRelatedId(String relatedId) {
        this.relatedId = relatedId;
    }

    public String getVideoId() {
        return videoId;
    }

    public void setVideoId(String videoId) {
        this.videoId = videoId;
    }

    public String getUploader() {
        return uploader;
    }

    public void setUploader(String uploader) {
        this.uploader = uploader;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Integer getLength() {
        return length;
    }

    public void setLength(Integer length) {
        this.length = length;
    }

    public Integer getViews() {
        return views;
    }

    public void setViews(Integer views) {
        this.views = views;
    }

    public Double getRate() {
        return rate;
    }

    public void setRate(Double rate) {
        this.rate = rate;
    }

    public Integer getRating() {
        return rating;
    }

    public void setRating(Integer rating) {
        this.rating = rating;
    }

    public Integer getComments() {
        return comments;
    }

    public void setComments(Integer comments) {
        this.comments = comments;
    }

    @Override
    public int compareTo(Video o) {
        return 0;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeUTF(videoId);
        dataOutput.writeUTF(uploader);
        dataOutput.writeInt(age);
        dataOutput.writeUTF(category);
        dataOutput.writeInt(length);
        dataOutput.writeInt(views);
        dataOutput.writeDouble(rate);
        dataOutput.writeInt(rating);
        dataOutput.writeInt(comments);
        dataOutput.writeUTF(relatedId);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.videoId = dataInput.readUTF();
        this.uploader = dataInput.readUTF();
        this.age = dataInput.readInt();
        this.category = dataInput.readUTF();
        this.length = dataInput.readInt();
        this.views = dataInput.readInt();
        this.rate = dataInput.readDouble();
        this.rating = dataInput.readInt();
        this.comments = dataInput.readInt();
        this.relatedId = dataInput.readUTF();
    }
}
